package com.imcrl.component.drager{
	import starling.display.DisplayObject;
	import starling.textures.Texture;
	
	import starlingui.component.drag.AbsIcon;

	/**
	 * 拖动指针图像类
	 * @author crl
	 * 
	 */	
	public class DefaultDragImage implements IDraggingImage{
		
		private var image:AbsIcon;
		private var width:int;
		private var height:int;
		
		public function DefaultDragImage(){
			
		}
		
		public function set data(value:*):void{
			var dragInitiator:DisplayObject=value;
			var w:int = dragInitiator.width;
			var h:int = dragInitiator.height;
			if(w==width && h==height){
				return;
			}
			width=w,height=h;
			
			var texture:Texture=Texture.empty(width,height);
			if(image==null){
				image = new AbsIcon(texture);
			}else{
				image.texture=texture;
				image.readjustSize();
			}
		}
		
		public function getDisplay():DisplayObject
		{
			return image;
		}
		
		public function switchToRejectImage():void
		{
			image.color=0xFF333333;	
		}
		
		public function switchToAcceptImage():void
		{
			image.color=0xFFFFFFFF;
		}
		
		public function set action(value:String):void{
			
		}
		
	}
}